import random

import redis
from flask import Blueprint, send_file, make_response
from flask_restful import Resource
from ronglian_sms_sdk import SmsSDK
from tools.captcha.captcha import captcha
from tools.myredis import r

from application.models.users.user import User
from flask import Blueprint,request,jsonify
user_blue = Blueprint("userblue",__name__)

from captcha.image import ImageCaptcha
@user_blue.route('/getcode')
def get_img():
    name,text,img=captcha.generate_captcha()
    uuid=request.args.get('uuid')
    r.str_add(uuid,text)
    cls = redis.Redis(host='127.0.0.1')
    print(">>>>>>>>>>>>>>>>",cls.get(uuid))
    res=make_response(img)
    res.headers['Content-Type']="image/jpg"
    return res


@user_blue.route('/sendSmsCode',methods=['post'])
def sendSmsCode():
    data = request.data




